package com.eastfair.builder.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展商
 * </p>
 *
 * @author linan
 * @date 2023-02-02
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitorProcessEnum", description = "进度#{IS_EARNEST_MONEY_SET:缴纳保证金;ARRANGEMENT:布展验收中;HAS_ARRANGEMENT:布展验收;DISMANTLING:撤展验收中;HAS_DISMANTLING:撤展验收;-枚举")
public enum ExhibitorProcessEnum implements BaseEnum {

    /**
     * IS_EARNEST_MONEY_SET="缴纳保证金"
     */
    IS_EARNEST_MONEY_SET("缴纳保证金"),
    /**
     * ARRANGEMENT="布展验收中"
     */
    ARRANGEMENT("布展验收中"),
    /**
     * HAS_ARRANGEMENT="布展验收"
     */
    HAS_ARRANGEMENT("布展验收"),
    /**
     * DISMANTLING="撤展验收中"
     */
    DISMANTLING("撤展验收中"),
    /**
     * HAS_DISMANTLING="撤展验收"
     */
    HAS_DISMANTLING("撤展验收"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitorProcessEnum match(String val, ExhibitorProcessEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitorProcessEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitorProcessEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "IS_EARNEST_MONEY_SET,ARRANGEMENT,HAS_ARRANGEMENT,DISMANTLING,HAS_DISMANTLING", example = "IS_EARNEST_MONEY_SET")
    public String getCode() {
        return this.name();
    }

}
